package com.ldk.base.framework.util.sms;

/**
 * 每个短信平台访问信息配置
 * @author xiangwl
 * 2016年9月28日
 * com.ycwl.platform.framework.sms
 * SmsConfig
 */
public class SmsConfig {

	/**
	 * 使用短信平台
	 */
	private SmsPlatform platform;
	/**
	 * 访问Key(一般是用户名)
	 */
	private String accessKey;
	/**
	 * 访问密码(一般是平台密码)
	 */
	private String accessPwd;
	/**
	 * 发送手机号，多个以,分开
	 */
	private String phonNos;
	/**
	 * 发送内容
	 */
	private String content;
	/**
	 * 短信签名
	 */
	private String signName;
	/**
	 * 短信模版
	 */
	private String templeteCode;
	
	/**
	 * 构造函数
	 * @param platform 短信平台
	 * @param accessKey 
	 * @param accessPwd
	 * @param phoneNos
	 * @param content
	 */
	private SmsConfig(SmsPlatform platform, String accessKey, String accessPwd, String phoneNos, String content){
		this.platform = platform;
		this.accessKey = accessKey;
		this.accessPwd = accessPwd;
		this.phonNos = phoneNos;
		this.content = content;
		this.signName = "";
		this.templeteCode = "";
	}
	/**
	 * 构造函数
	 * @param platform 短信平台
	 * @param accessKey 
	 * @param accessPwd
	 * @param phoneNos
	 * @param content
	 * @param signName
	 * @param templeteCode
	 */
	private SmsConfig(SmsPlatform platform, String accessKey, String accessPwd, String phoneNos, String content, String signName, String templeteCode){
		this.platform = platform;
		this.accessKey = accessKey;
		this.accessPwd = accessPwd;
		this.phonNos = phoneNos;
		this.content = content;
		this.signName = signName;
		this.templeteCode = templeteCode;
	}
	
	/**
	 * 新的构建器
	 * @return
	 */
	public static Builder newBuilder() {
		return new Builder();
	}
	
	public SmsPlatform getPlatform() {
		return platform;
	}
	
	public String getAccessKey() {
		return accessKey;
	}
	
	public String getAccessPwd() {
		return accessPwd;
	}
	
	public String getPhonNos() {
		return phonNos;
	}
	
	public String getContent() {
		return content;
	}
	public String getSignName() {
		return signName;
	}
	public String getTempleteCode() {
		return templeteCode;
	}
	
	public static class Builder{
		/**
		 * 使用短信平台
		 */
		private SmsPlatform platform;
		/**
		 * 访问Key(一般是用户名)
		 */
		private String accessKey;
		/**
		 * 访问密码(一般是平台密码)
		 */
		private String accessPwd;
		/**
		 * 发送手机号，多个以,分开
		 */
		private String phonNos;
		/**
		 * 发送内容
		 */
		private String content;
		/**
		 * 短信签名
		 */
		private String signName;
		/**
		 * 短信模版
		 */
		private String templeteCode;
		
		public Builder setPlatform(SmsPlatform platform) {
			this.platform = platform;
			return this;
		}
		
		public Builder setAccessKey(String accessKey) {
			this.accessKey = accessKey;
			return this;
		}
		public Builder setAccessPwd(String accessPwd) {
			this.accessPwd = accessPwd;
			return this;
		}
		public Builder setPhonNos(String phonNos) {
			this.phonNos = phonNos;
			return this;
		}
		public Builder setContent(String content) {
			this.content = content;
			return this;
		}
		public Builder setSignName(String signName) {
			this.signName = signName;
			return this;
		}
		
		public Builder setTempleteCode(String templeteCode) {
			this.templeteCode = templeteCode;
			return this;
		}
		/**
		 * 构建配置
		 * @return
		 */
		public SmsConfig build(){
			return new SmsConfig(platform, accessKey, accessPwd, phonNos, content, signName, templeteCode);
		}
	}
}
